import babel from 'rollup-plugin-babel';
import eslint from 'rollup-plugin-eslint';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';

export default {
  entry: './test/test/index.js',
  dest: './dist/script/test.js',
  format: 'iife',
  sourceMap: 'inline',
  moduleName: 'test', 
  name: "mytest",

  plugins: [
    /*
    resolve({
      //jsnext: true, //将 Node 包转换为 ES2015 模块
      //index: true,  //index 和 browser 属性将使插件决定将哪些文件应用到 bundle
      //browser: true,
    }),

    commonjs(),
    */
    resolve({
      jsnext: true,
      //main: true,
      browser: true
    }),
    commonjs(),
    babel({
      exclude: 'node_modules/**',
    }),
    eslint({
      exclude: [
        'src/styles/**',
      ]
    }),
    replace({
      ENV: JSON.stringify(process.env.ENV || 'dev'),
    }),
    (process.env.ENV === 'production' && uglify()),
  ],
}
